package com.lry.protocol;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class RpcResult implements Serializable {

    private byte code;
    private Object object;
    private String err;

    public RpcResult(Object object, String err) {
        this.object = object;
        this.err = err;
        if(null!=object){
            this.code = ResultEnums.OK.getCode();
        }else{
            this.code = ResultEnums.FAIL.getCode();
        }
    }
}
